import React,{useState} from 'react'
import useUpdate from './customHooks/useUpdate'


const FnTest = () => {
  const [n, setN] = useState(0)
  const [m, setM] = useState(0)
  const onClick = ()=>{
    setN(n+1)
  }
  const onClick2 = ()=>{
    setM(m+1)
  }
  useUpdate(()=>{console.log('渲染了')},n)
  return (
    <React.Fragment>
      <div>{n}</div>
      <button onClick={onClick}>+1</button>
      <div>{m}</div>
      <button onClick={onClick2}>+1</button>
    </React.Fragment>
  )
}
export default FnTest